const FileManagerPlugin = require('filemanager-webpack-plugin');
var package = require('./package.json');
module.exports = {
    publicPath: './',
    outputDir: 'D:\\nginx-1.16.1\\html\\taskApp',
    // outputDir: 'D:\\Program Files\\nginx-1.16.1\\html\\taskApp',
    // outputDir: 'www',
    productionSourceMap: false,
	devServer: {
		proxy: {
			'/gss': {
				target: process.env.VUE_APP_PATH,
				changeOrigin: true
			}
		}
	},
    css: {
        loaderOptions: {
            postcss: {
                plugins: [
                    require('postcss-px2rem')({remUnit: 37.5}), //该参数根据设计稿调整，若设计稿为750则这里应为75
                ]
            }
        }
    },
    configureWebpack: { 
        plugins: [
            new FileManagerPlugin({ //初始化 filemanager-webpack-plugin 插件实例
                onEnd: {
                    delete: ['./dist/','./archive/'+package.version+'*.zip'],//删除dist文件夹下面的所有文件和archive文件下的版本包
                    mkdir: ['./www', './dist','./archive/'+package.version],//创建文件夹
                    copy: [
                        {source: './www/', destination: './dist'}, //将生成的www移动复制到dist目录下的www
                    ],
                    archive: [ //然后我们选择www文件夹将之打包成gss-app.zip并放在根目录
                        {source: './dist', destination: './archive/'+package.version+'/gss-app.zip'},
                    ]
                }
            }),
        ]
    },
    // chainWebpack: config => {
    //     return config.output.filename('[name].[contenthash].js').chunkFilename('js/[name].[contenthash].js').end();
	//
    // },
};